//
//  RBMeCell.m
//  Budejie
//
//  Created by 华杨科技 on 2017/10/11.
//  Copyright © 2017年 饶波. All rights reserved.
//

#import "RBMeCell.h"

@implementation RBMeCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        self.textLabel.textColor = [UIColor darkGrayColor]; 
        
        // 箭头>
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
//        self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]]; // 不使用系统箭头
        
        // 设置cell背景图片:1.Accests.xcassets ---> 2.选中一个图片---> 3.右边👉第三个图标(向下箭头⬇️)--->4.最后面Slicing --->Slices 选者 “Horizontal and Vertical”
        self.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mainCellBackground"]]; 
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews]; 
    
    if (self.imageView.image == nil)  return;
    
    // UIImageView
    self.imageView.rb_y = RBSmallMargin;
    self.imageView.rb_height = self.contentView.rb_height - 2*RBSmallMargin;
//    self.imageView.rb_width = self.imageView.rb_height; // 等宽/等高;只实用正方形.推荐使用 initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
    
    // Label
    self.textLabel.rb_x = self.imageView.rb_right + RBMargin;
}

@end
